//
// Created by Lin on 2022/10/24.
//

#include <iostream>

using namespace std;

void printArr(int *arrP, int n)
{
    for (int i = 0; i < n; ++i)
        printf("%d ", *arrP++);
    printf("\n");
}

int main()
{
    int len = 10;
    int arr[10] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
    printArr(arr, len);
    for (int i = 1; i < len; ++i)
    {
        int j = i;
        int var = arr[i + 1];
        while (j >= 0 && var < arr[j])
        {
            arr[j+1]=arr[j];
            j--;
        }
        arr[j+1]=var;
    }
    printArr(arr,len);

}